<?php
/**
 * URL Amigavel
 * Author: Bruno Ramos <contato [AT] brunoramos [DOT] eti [DOT] br>
 * File: geturl.php
 * Version: 1.0
 */

// Url Base
$baseUrl = 'http://'.$_SERVER['HTTP_HOST'];

// Define a url "base" no smarty
$smarty->assign('base', $baseUrl);

// Recupera url total
$urlPath = htmlspecialchars($_SERVER['REQUEST_URI']);

// Reparte url
$url_array = explode("/",$urlPath);

// Escolhe a posicao inicial do array
$url = array_slice($url_array, 1);

// Define a variavel "url" no smarty
$smarty->assign('url',$url);

// Define a variavel para url relativa no smarty
$smarty->assign('tpl','/templates/'.$config['template']);

?>
